#Copyright (C) 2006-2009  Open Data ("Open Data" refers to
#one or more of the following companies: Open Data Partners LLC,
#Open Data Research LLC, or Open Data Capital LLC.)
#
#This file is part of Augustus.
#
#Augustus is free software; you can redistribute it and/or
#modify it under the terms of the GNU General Public License
#as published by the Free Software Foundation; either version 2
#of the License, or (at your option) any later version.
#
#This program is distributed in the hope that it will be useful,
#but WITHOUT ANY WARRANTY; without even the implied warranty of
#MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
#GNU General Public License for more details.
#
#You should have received a copy of the GNU General Public License
#along with this program; if not, write to the Free Software
#Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA

BEGIN{
}
{
   date=$1;
   color=$2;
   for (i=0;i<5;i++) {
     make=$(3+i+i);
     cnt=$(4+i+i);
     tot[color,make]+=cnt;
     mtot[make]+=cnt;
     ctot[color]+=cnt;
   }
}
END{
   print "Totals by color"
   for (c in ctot) { print c, ctot[c]; }
   print "Totals by make"
   for (m in mtot) { print m, mtot[m]; }
   print "Totals by make,color"
   for (m in mtot) {
     for (c in ctot) {
       print m,c,tot[c,m];
     }
   }
}
